<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

</body>
<script>
let o = {username: 'zs'}
let m = {age: 20}
//es5
/*
let n = {}
// 对象合并法一：
for(var key in o){
    n[key] = o[key]
}
for(var key in m){
    n[key] = m[key]
}
console.log(n)
*/
//es6
/*==============================⭐ 对象合并法二：运算符  ==============================*/
// let n = {...o, ...m}
//// 对象合并法三：对象的新方法
let n = Object.assign({}, o, m)
console.log(n)
</script>
</html>
